home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Medal Software 2
/
Gold Medal Software Volume 2 (Gold Medal) (1994).iso
/
prog
/
bozol2.arj
/
CALC.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1993-11-17
|
777b
|
19 lines
CASE "CALC","EVAL","WHAT"
' Build an expression to calculate by stringing together
' all pushed arguments that may constitute an arithmetic
' expression. When we come to a non arithmetic symbol or
' bit of text, push it back and calculate what we have.
A$=""
DO
B$=POPARG$
IF VERIFY(B$,"01234567890 .+-/\*^()><=") THEN
PUSHARG B$
EXIT LOOP
END IF
A$=A$+B$
LOOP WHILE ArgPtr%>0
PUSHARG STR$(CALC(A$))
CASE "+","-","/","\","*","^","(",")",">","<","=","&"
PUSHARG PRG$